package com.xjoyt.pay.merchant.register.po;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xjoyt.pay.vo.PayType;

@Entity
@Table(name = "t_merchant_rate_detail")
public class MerchantRateDetail {

	@Id
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	@Column(name = "merchant_rate_detail_id", length = 36)
	public String id;

	/**
	 * 商户
	 */
	@ManyToOne(targetEntity = MerchantRate.class, cascade = {})
	@JoinColumn(name = "merchant_rate_id", foreignKey = @ForeignKey(name = "none"))
	@JsonIgnore
	public MerchantRate merchantRate;

	/**
	 * 类型(如：微信，支付宝)
	 */
	@Column(name = "`type`", length = 20)
	@Enumerated(EnumType.ORDINAL)
	public PayType type;

	/**
	 * 费率(‰)
	 */
	@Column(name = "rate", precision = 10, scale = 6)
	public Double rate;
	
}
